import React from 'react';
import {Popoverm, Carousel, Button, message, Modal} from "antd";
import {SortableContainer, SortableElement, arrayMove} from 'react-sortable-hoc';

import {WeaLocaleProvider, WeaTools,WeaFormItem, WeaInput,WeaMoreButton} from 'ecCom'
import { WeaDialog} from 'ecCom';
const { callApi } = WeaTools;
const getLabel = WeaLocaleProvider.getLabel;
import './style/index';

class ContainerSetting extends React.Component {
    constructor(props){
        super(props)
        this.state = {
           data : {
               rowCol : "",
           }
        }
    }

    componentWillMount(){
       this.setStateData({"rowCol": this.props.data.rowCol})
    }

    setStateData = (stateData)=>{
        let data =  Object.assign(this.state.data ,stateData);
        this.setState({
            data
        })

    }


    render() {
        const colProps = {
            labelCol: {span: 6},
            wrapperCol: {span: 16}
        };
       return  (<WeaDialog
            title="布局设置"
            visible={this.props.data.showContainerSetting }
            iconBgcolor='#1a57a0'
            hasScroll={true}
            style={{width: 1200,height : 600}}
            buttons={this.getButtons()}
            onCancel={()=>{this.props.setShowContainerSetting(false)}}
        >
            <WeaFormItem label="行*列" {...colProps}>
                <WeaInput value={this.state.data.rowCol} viewAttr={3} onChange={value => this.setStateData({"rowCol": value})}/>
            </WeaFormItem>
        </WeaDialog>)
    }
    getButtons = () =>{


        let btns = [];
        btns.push(<Button type="primary" onClick={()=>{this.props.saveCustomContainerSetting(this.state.data)}}>{getLabel(30986, '保存')}</Button>);
        btns.push(<WeaMoreButton datas={this.getRightMenus()}/>);
        return btns;
    }
    getRightMenus= () =>{


        let btns = [];
        btns.push({key: '1', icon: <i className="icon-coms-Preservation"/>, content: getLabel(30986, '保存'), onClick: ()=>{this.props.saveCustomContainerSetting(this.state.data)} });
        return btns;
    }
}

export default ContainerSetting;